<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="grails.util.Environment" %>
<html>
<head>
    <meta name="layout" content="grame"/>
    <title>System Information</title>
    <meta name="keywords" content="grails, runtime, system, information"/>
    <meta name="description" content="Grame runtime information."/>
</head>

<body>
<div class="container" id="content">
    <div class="row">
        <div class="panel panel-info" ng-app="NavigatorInfo">
            <div class="panel-heading">
                <h3 class="panel-title">Navigator Information</h3>
            </div>

            <div class="panel-body" ng-controller="NavigatorController">
                <ul id="navigator_info">
                    <li>App code name: {{navigator.appCodeName}}</li>
                    <li>App name: {{navigator.appName}}</li>
                    <li>App version: {{navigator.appVersion}}</li>
                    <li>Cookie enabled: {{navigator.cookieEnabled}}</li>
                    <li>Platform: {{navigator.platform}}</li>
                    <li>User agent: {{navigator.userAgent}}</li>
                </ul>
            </div>
        </div>

        <div class="panel panel-info">
            <div class="panel-heading">
                <h3 class="panel-title">Runtime Information</h3>
            </div>

            <div class="panel-body">
                <ul id="runtime_info">
                    <li>Runtime OS: ${System.getProperty('os.name')}</li>
                    <li>Runtime OS arch: ${System.getProperty('os.arch')}</li>
                    <li>Runtime OS version: ${System.getProperty('os.version')}</li>
                    <li>Runtime user: ${System.getProperty('user.name')}</li>
                    <li>Runtime user home: ${System.getProperty('user.home')}</li>
                    <li>Runtime user language: ${System.getProperty('user.language')}</li>
                    <li>Runtime language encoding: ${System.getProperty('file.encoding')}</li>
                    <li>Runtime user timezone: ${System.getProperty('user.timezone')}</li>
                    <li>Runtime directory: ${System.getProperty('user.dir')}</li>
                    <li>Runtime temp directory: ${System.getProperty('java.io.tmpdir')}</li>
                    <li>Runtime JVM: ${System.getProperty('java.home')}</li>
                    <li>Runtime JVM version: ${System.getProperty('java.version')}</li>
                    <li>Runtime class path: <br/>
                        <g:each in="${System.getProperty('java.class.path').split(":")}" var="path">
                            ${path}<br/>
                        </g:each>
                    </li>
                    <li>Runtime library path: <br/>
                        <g:each in="${System.getProperty('java.library.path').split(":")}" var="path">
                            ${path}<br/>
                        </g:each>
                    </li>
                </ul>
            </div>
        </div>

        <div class="panel panel-info">
            <div class="panel-heading">
                <h3 class="panel-title">Application Status</h3>
            </div>

            <div class="panel-body">
                <ul>
                    <li>App version: <g:meta name="app.version"/></li>
                    <li>Grails version: <g:meta name="app.grails.version"/></li>
                    <li>Groovy version: ${GroovySystem.getVersion()}</li>
                    <li>JVM version: ${System.getProperty('java.version')}</li>
                    <li>Reloading active: ${Environment.reloadingAgentEnabled}</li>
                    <li>Controllers: ${grailsApplication.controllerClasses.size()}</li>
                    <li>Domains: ${grailsApplication.domainClasses.size()}</li>
                    <li>Services: ${grailsApplication.serviceClasses.size()}</li>
                    <li>Tag Libraries: ${grailsApplication.tagLibClasses.size()}</li>
                </ul>
            </div>
        </div>

        <div class="panel panel-info">
            <div class="panel-heading">
                <h3 class="panel-title">Installed Plugins</h3>
            </div>

            <div class="panel-body">
                <ul>
                    <g:each var="plugin"
                            in="${applicationContext.getBean('pluginManager').allPlugins.sort { a, b -> a.name == b.name ? 0 : a.name < b.name ? -1 : 1 }}">
                        <li>${plugin.name} - ${plugin.version}</li>
                    </g:each>
                </ul>
            </div>
        </div>

        <div class="panel panel-info">
            <div class="panel-heading">
                <h3 class="panel-title">Controllers</h3>
            </div>

            <div class="panel-body">
                <ul>
                    <g:each var="c" in="${grailsApplication.controllerClasses.sort { it.fullName }}">
                        <li><g:link controller="${c.logicalPropertyName}">${c.fullName}</g:link></li>
                    </g:each>
                </ul>
            </div>
        </div>
    </div>
</div>
<content tag="script">
    <script type="text/javascript">
        (function () {
            'use strict';
            angular.module('NavigatorInfo', [])
                    .controller('NavigatorController', ['$scope', function ($scope) {
                        $scope.navigator = navigator;
                    }]);
        })();
    </script>
</content>
</body>
</html>